<!DOCTYPE html>
<html>
<head lang="en">
    <meta charset="UTF-8">
    <title>判断是不是数组</title>
</head>
<body>
<script>
   /* if (value instanceof Array ||
            (!(value instanceof Object) &&
            (Object.prototype.toString.call((value)) == '[object Array]') ||
            typeof value.length == 'number' &&
            typeof value.splice != 'undefined' &&
            typeof value.propertyIsEnumerable != 'undefined' &&
            !value.propertyIsEnumerable('splice'))) {
        return 'array';
    }*/
   var array={};
    var is_array = function(value) {
        return value && typeof value === 'object' && typeof value.length === 'number' && typeof value.splice === 'function' && !(value.propertyIsEnumerable('length'));
    };
    var is_array2= function(value) {
        return Object.prototype.toString.call(value) == '[object Array]';
    };
   console.log(is_array(array));
   console.log(is_array2(array));
   function MyObject() {
       this.name = "我是实例的属性";
   }
   var obj = new MyObject();
   console.log(obj.propertyIsEnumerable("name"));//true
   MyObject.prototype.say = "我是原型的属性";
   console.log(obj.propertyIsEnumerable("say")); //false
   for (var i in obj) {
       console.log(i);//name,say
   }

   var arr = new Array(6);
   arr[0] = "George";
   arr[1] = "John";
   arr[2] = "Thomas";
   arr[3] = "James";
   arr[4] = "Adrew";
   arr[5] = "Martin";

   document.write(arr + "<br />");
   arr.splice(2,3,"William");
   document.write(arr + "<br />");


   var toString = Object.prototype.toString;

   console.log(toString.call([123]));//[object Array]
   console.log(toString.call('123'));//[object String]
   console.log(toString.call({a: '123'}));//[object Object]
   console.log(toString.call(/123/));//[object RegExp]
   console.log(toString.call(123));//[object Number]
   console.log(toString.call(undefined));//[object Undefined]
   console.log(toString.call(null));//[object Null]
        var a;
    console.log(typeof a);
    console.log(typeof undefined);
   console.log(![]);
   console.log(![]==[]);
    var foo="11"+2;
   console.log(foo);
   console.log( typeof foo);

</script>
</body>
</html>